package pdm.traj.util.timeslot;

import java.util.List;

public class DateFileOffsetTSMap {
	private String datePath;
	private FileTimeSlotMap ftsm;
	
	public DateFileOffsetTSMap(String datePath, FileTimeSlotMap ftsm) {
		this.datePath = datePath;
		this.ftsm = ftsm;
	}

	public String getDatePath() {
		return datePath;
	}

	public void setDatePath(String datePath) {
		this.datePath = datePath;
	}

	public FileTimeSlotMap getFtsm() {
		return ftsm;
	}

	public void setFtsm(FileTimeSlotMap ftsm) {
		this.ftsm = ftsm;
	}

	public String toString() {
		return datePath + "\t" + ftsm;
	}
	
	public boolean equals(DateFileOffsetTSMap m) {
		return (this.datePath.equals(m.datePath) && this.ftsm.equals(m.ftsm));
	}
	
	public static boolean contains(List<DateFileOffsetTSMap> l, DateFileOffsetTSMap map) {
		for (DateFileOffsetTSMap tmp : l) {
			if (tmp.equals(map)) {
				return true;
			}
		}
		return false;
	}
	
	public static boolean inList(List<DateFileOffsetTSMap> l, String date, String filePath, int offset) {
		for (DateFileOffsetTSMap tmp : l) {
			if (tmp.datePath.equals(date) && 
					tmp.ftsm.getFilePath().equals(filePath) && 
					tmp.ftsm.getOffset() == offset) {
				return true;
			}
		}
		return false;
	}
}
